﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;

namespace EC18_ESHOP.Models
{
    public class PayPalModel
    {
        public string cmd { get; set; }
        public string upload { get; set; }
        public string business { get; set; }
        public string no_shipping { get; set; }
        public string @return { get; set; }
        public string cancel_return { get; set; }
        public string notify_url { get; set; }
        public string currency_code { get; set; }
        public string actionURL { get; set; }

        //public string item_name { get; set; }
        //public string amount { get; set; }
        private List<Item> listItem = new List<Item>();

        public List<Item> ListItem
        {
            get { return listItem; }
            set { listItem = value; }
        }

        //public string item_name_1 { get; set; }
        //public string amount_1 { get; set; }
        //public string item_name_2 { get; set; }
        //public string amount_2 { get; set; }

        public PayPalModel(bool useSandbox)
        {
            //this.cmd = "_xclick";
            this.cmd = "_cart";
            this.upload = "1";
            this.no_shipping = "0";
            this.business = ConfigurationManager.AppSettings["businessemail"];
            this.cancel_return = ConfigurationManager.AppSettings["cancel_url"];
            this.@return = ConfigurationManager.AppSettings["success_url"];
            if (useSandbox)
            {
                this.actionURL = ConfigurationManager.AppSettings["Test_url"];
            }
            else
            {
                this.actionURL = ConfigurationManager.AppSettings["Live_url"];
            }
            
            this.notify_url = ConfigurationManager.AppSettings["notify_url"];
            this.currency_code = ConfigurationManager.AppSettings["currency_code"];
            // Ta có thể thêm một số thông số khác
        }

        public string item_name_x()
        {
            return "item_name_3";
        }
    }


    public class Item
    {
        public string item_name { get; set; }
        public string amount { get; set; }
        public int quantity { get; set; }
    }
}